import { devHttp } from '@/services/hbhttp.js'
const $http=devHttp;

/**
* 获取订餐任务
*/
export const postFoodTaskList = (params) => {
	return $http.post('food/getTask',params)
};

/**
* 获取订餐详情
*/
export const getFoodDietConfig = (params) => {
	return $http.post('food/getDietConfig',params)
};


/**
* 添加，修改，删除订餐任务
*/
export const postTaskList = (params) => {
	return $http.post('food/task',params)
};


/**
* 获取每日订餐信息
*/
export const postFoodDietList = (params) => {
	return $http.post('food/getDiet',params)
};



/**
* 查询统计日报(饭堂人员周末需要)
*/
export const getDietStatistics = (params) => {
	return $http.post('foodStatistics/getDietStatistics',params)
};



/**
* 获取部门临时表
*/
export const getTemporaryAll = (params) => {
	return $http.get('foodTemporary/getTemporaryAll',params)
};



/**
* 临时查询报餐
*/
export const postTemporary = (params) => {
	return $http.post('foodTemporary/getTemporary',params)
};



/**
* 临时新增或者修改报餐
*/
export const taskTemporary = (params) => {
	return $http.post('foodTemporary/taskTemporary',params)
};


// /**
// *  修改订餐图片
// */
// export const setDietConfig = (params) => {
// 	return $http.post('foodStatistics/setDietConfig',params)
// };


// 上传文件
export const setDietConfig = (filePath) => {
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: 'https://limsapi.gzhbcss.com/foodStatistics/setDietConfig',
			filePath: filePath,
			name: 'file',
			header: {
				'Content-Type': 'multipart/form-data',
				'Authorization': uni.getStorageSync('token')
			},
			success: (uploadResult) => {
				resolve(uploadResult); // 上传成功
			},
			fail: (error) => {
				reject(error); // 上传失败
			}
		});
	});
}


